/**
 * Created by Daniel on 2017/8/24.
 */
'use strict';
var router = require('express').Router();
var AV = require('leanengine');
var functionTool = require('../queryFun/functionTool');

var Todo = AV.Object.extend('Todo');

// 查询 Todo 列表

router.get('/usersInformation', function(req, res, next) {

    res.render('edit/usersInformation', {});
});

router.get('/usersStatus', function(req, res, next) {

    res.render('edit/usersStatus', {});
});

router.get('/shopVerifyManger', function(req, res, next) {

  res.render('mall/shopVerifyManger', {});
});

router.get('/shopManger', function(req, res, next) {

    res.render('mall/shopManger', {});
});

router.get('/add', function(req, res, next) {

    res.render('edit/add', {});
});
//部落管理
router.get('/tribeMG', function(req, res, next) {

    res.render('tribe/tribeMG', {});
});
//部落帖子管理
router.get('/tribeThreadMG', function(req, res, next) {

  res.render('tribe/tribeThreadMG', {});
});
//部落分类列表排序
router.get('/tribeList', function(req, res, next) {

    res.render('tribe/tribeList', {});
});
//商品管理
router.get('/goodsManger', function(req, res, next) {

    res.render('mall/goodsManger', {});
});
//站外商品管理
router.get('/externalGoodsManger', function(req, res, next) {
  res.render('mall/externalGoodsManger', {});
});
router.get('/externalGoodsImport', function(req, res, next) {
  res.render('mall/externalGoodsImport', {});
});
//商品分类管理
router.get('/goodsTypeManger', function(req, res, next) {

  res.render('mall/goodsTypeManger', {});
});

router.get('/goodsTribeCorrelation', function(req, res, next) {

  res.render('mall/goodsTribeCorrelation', {});
});
router.get('/shopList', function(req, res, next) {

    res.render('mall/shopList', {});
});



router.get('/userAuthorization', function(req, res, next) {

    res.render('authorization/userAuthorization', {});
});

router.get('/level', function(req, res, next) {

    res.render('level/levelManger', {});
});

router.get('/levelTree', function(req, res, next) {

    res.render('level/levelTree', {});
});

router.get('/auth', function(req, res, next) {

    res.render('auth/find', {});
});

router.get('/orderManger', function(req, res, next) {

    res.render('order/orderManger', {});
});
router.get('/groupActivityManger', function(req, res, next) {
    functionTool.getGoodsParentType(goodsParentType=>{
        res.render('group/groupActivityManger',{
            goodsParentType:JSON.stringify(goodsParentType)
        })
    })
});

router.get('/addGroupActivity',function (req,res) {
        res.render("group/addGroupActivity");
})

router.get('/groupManger', function(req, res, next) {
    functionTool.getGoodsParentType(goodsParentType=>{
        res.render('group/groupManger',{
            goodsParentType:JSON.stringify(goodsParentType)
        })
    })
});
router.get('/sameGroupOrder', function(req, res, next) {
    res.render('group/sameGroupOrder',{})
});

router.get('/userList', function(req, res, next) {

    res.render('mall/userList', {});
});

router.get('/admin/userAdd', function(req, res, next) {

    res.render('admin/add', {});
});

//部落直播管理
router.get('/tribeLive',function (req,res,next) {
    res.render('tribe/tribeLive',{})
})

//直播管理
router.get('/live', function(req, res, next) {

    res.render('live/liveHome', {});
});

router.get('/tribeChoice', function(req, res, next) {

    res.render('live/tribeChoice', {});
});

router.get('/player', function(req, res, next) {

    res.render('live/livePlayer', {});
});

router.get('/account', function(req, res, next) {

    res.render('account/accountList', {});
});

router.get('/tribalCreation', function(req, res, next) {

    res.render('tribe/tribalCreation/tribalCreationUser', {});
});

router.get('/SynchronizationLiveTribe', function(req, res, next) {

    res.render('tribe/sync/live', {});
});

router.get('/where', function(req, res, next) {

    res.render('account/where', {});
});

router.get('/userMerge', function(req, res, next) {

    res.render('edit/userMerge', {});
});
router.get('/userIdentifyPropMG', function(req, res, next) {

  res.render('edit/userIdentifyPropMG', {});
});
router.get('/userIdentifyPropAdd', function(req, res, next) {

  res.render('edit/userIdentifyPropAdd', {});
});

router.get('/tribeChildBrand', function(req, res, next) {

    res.render('tribe/tribeShare/tribeChildBrand', {});
});
router.get('/tribeChildBrandArticle', function(req, res, next) {

  res.render('tribe/tribeShare/tribeChildBrandArticle', {});
});
router.get('/suggestion', function(req, res, next) {

    res.render('suggestion/suggestionList', {});
});

router.get('/adminUser', function(req, res, next) {

    res.render('admin/user', {});
});

router.get('/wxGroup', function(req, res, next) {

    res.render('wxGroup/list', {});
});

router.get('/classification', function(req, res, next) {

    res.render('classification/list', {});
});
/**
 * banner图管理
 */
router.get('/bannermanager', function(req, res, next) {

    res.render('shop/banner/bannerManager', {});
});

router.get('/userTribeMG', function(req, res, next) {

    res.render('tribe/userTribeMG/list', {});
});

router.get('/version', function(req, res, next) {

    res.render('version/list', {});
});

router.get('/smallRoutineVersion', function(req, res, next) {

    res.render('smallRoutineVersion/smallList', {});
});

router.get('/userAddress', function(req, res, next) {

    res.render('edit/userAddress', {});
});

router.get('/userFriends', function(req, res, next) {

    res.render('edit/userFriends', {});
});

router.get('/total', function(req, res, next) {

    res.render('account/total', {});
});


router.get('/regTribe', function(req, res, next) {

    res.render('reg/regTribe', {});
});
router.get('/regUser', function(req, res, next) {

    res.render('reg/regUser', {});
});

router.get('/intergation',function (req,res,next) {
  functionTool.getGoodsParentType(goodsParentType=>{
    res.render('mall/shopIntergation',{
      goodsParentType:JSON.stringify(goodsParentType)
    })
})
})
router.get('/tecShop',function (req,res,next) {
  res.render('mall/tecShop')
})
router.get('/shopGoodsChoice', function(req, res, next) {

    res.render('mall/shopGoodsChoice', {});
});
router.get('/bestSeller',function (req,res,next) {
    res.render('mall/bestSeller',{})
})
router.get('/tribeBonus',function (req,res,next) {
    res.render('tribe/tribeBonus',{})
})
//积分比例管理
router.get('/integralRatio', function(req, res, next) {

  res.render('integralRatio/integralRatio', {});
});
//问卷调查
router.get('/questionManger', function(req, res, next) {
  res.render('question/questionManger', {});
});
router.get('/questionAdd', function(req, res, next) {
  res.render('question/questionAdd', {});
});
router.get('/goodsTribeCorrelationAdd', function(req, res, next) {
  res.render('mall/goodsTribeCorrelationAdd', {});
});
router.get('/rtmpUrlToIPShowView', function(req, res, next) {
  res.render('live/rtmpUrlToIPShowView', {rtmpUrl: req.query.rtmpUrl});
});
router.get('/userInviteFriendsManage', function(req, res, next) {
  res.render('edit/userInviteFriendsManage', {});
});
router.get('/systemSendScore', function(req, res, next) {
  res.render('edit/systemSendScore', {});
});

router.get('/shopPopUpLogoManger', function(req, res, next) {
  res.render('mall/shopPopUpLogoManger', {});
});
router.get('/scoreShopGoodsChoice', function(req, res, next) {

  res.render('mall/scoreShopGoodsChoice', {});
});
router.get('/scoreShopGoodsChoiceNoGroup', function(req, res, next) {

    res.render('mall/scoreShopGoodsChoiceNoGroup', {});
});

router.get('/businessCollegeClassifyManager', function(req, res, next) {

    res.render('minePage/businessCollegeClassifyManager', {});
});

router.get('/addClassifySubItem', function(req, res, next) {
    res.render('minePage/addClassifySubItem', {classifyOId: req.query.classifyOId});
});
router.get('/editClassifySubItem', function(req, res, next) {
    res.render('minePage/editClassifySubItem', {objectId: req.query.objectId,title: req.query.title,content: req.query.content});
});
router.get('/walletManage', function(req, res, next) {
  res.render('wallet/walletManage', {});
});
router.get('/externalGoodsChoice', function(req, res, next) {
  res.render('mall/externalGoodsChoice', {});
});
router.get('/externalGoodsChoice', function(req, res, next) {
  res.render('mall/externalGoodsChoice', {});
});

router.get('/externalGoodsMultiChoice', function(req, res, next) {
  res.render('mall/externalGoodsMultiChoice', {});
});
// 新增 Todo 项目
router.post('/', function(req, res, next) {
    var content = req.body.content;
    var todo = new Todo();
    todo.set('content', content);
    todo.save().then(function(todo) {
        res.redirect('/todos');
    }).catch(next);
});

module.exports = router;